<?php echo $header; ?>
<div id="content">
   <div class="breadcrumb">
    <?php echo $this->breadCrumbs(); ?>
  </div>
  <?php if (isset($error_warning)) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/product.png" alt="" /><?php echo $_['heading_title'];?></h1>
      <div class="buttons">
      <span style="margin-right:5px;">
		<select onchange="filter()" name="filter_category_id">
			<option value="*">[ <?php echo $_['text_category']; ?> ]</option>
			<?php echo form_select_option($categories, $filter_category_id, null, 'category_id', 'name');?>
		</select>
	 </span>
		 |
      <a onclick="location = '<?php echo UA('article/article/insert'); ?>'" class="button"><span><?php echo $_['button_insert']; ?></span></a>
      <a onclick="$('#form').submit();" class="button"><span><?php echo $_['button_delete']; ?></span></a>
      
      </div>
    </div>
    <div class="content">
      <form action="<?php echo UA('article/article/delete'); ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="list">
          <thead>
            <tr height="30">
              <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
              <td width="50">ID</td>
			  <td><?php echo $_['text_title']; ?></td>
			  <td><?php echo $_['text_date_added'];?></td>
			  <td><?php echo $_['text_date_modified'];?></td>
			  <td><?php echo $_['text_hits'];?></td>
			  <td width="100"><?php echo $_['text_action']; ?></td>
            </tr>
          </thead>
          <tbody>
            <?php if ($articles) { ?>
            <?php foreach ($articles as $article) { ?>
            <tr  height="30" onmouseover="this.className='on';" onmouseout="this.className='';">
              <td style="text-align: center;">
              <input type="checkbox" name="selected[]" value="<?php echo $article['article_id']; ?>" /></td>
			  <td><?php echo $article['article_id']; ?></td>
			  <td><a href="<?php echo $article['link'];?>" target="_blank"><?php echo $article['title']; ?></a></td>
			  <td><?php echo $article['date_added']; ?></td>
			  <td><?php echo $article['date_modified']; ?></td>
			  <td><?php echo $article['hits']; ?></td>
			  <td>				
				[<a href="<?php echo UA('article/article/update'); ?>&article_id=<?php echo $article['article_id']?>"><?php echo $_['text_edit']; ?></a>]
			  </td>
            </tr>
            <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="15"><?php echo $_['text_no_results']; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
      </form>
	  <div class="pagination"><?php echo $pagination; ?></div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function filter() {
	url = '<?php echo UA('article/article', 'filter_reset=1'); ?>';

	v = $('select[name=\'filter_category_id\']').attr('value');
	if (v != '*') {
		url += '&filter_category_id=' + encodeURIComponent(v);
	}
	location = url;
}
//--></script>
<?php echo $footer; ?>